package com.qys.livesMall.shop.modal.dto.shop.rwnew;

import com.qys.livesMall.framework.view.BaseQuery;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.List;

/**
 * @menu ShopWlSearch
 * @date 2023/08/23 17:10
 */
@Data
public class ShopWlSearch extends BaseQuery {


    /***************用户信息*************/


    @Schema(description = "用户名")
    private String userName;

    @Schema(description = "用户系统类型（0：水军，1：正常用户）")
    private Integer userSysType;

    @Schema(description = "用户直推")
    private String userDirectPush;

    @Schema(description = "用户三代")
    private String user3rdGeneration;

    @Schema(description = "用户伞下")
    private String userUnderUmbrella;



    /*************店铺************/

    @Schema(description = "店铺编码")
    private String shopCode;

    @Schema(description = "状态")
    private String shopStatus;

    @Schema(description = "余额范围下限")
    private BigDecimal balanceStart;

    @Schema(description = "余额范围上限")
    private BigDecimal balanceEnd;

    @Schema(description = "店铺名称")
    private String shopName;

    @Schema(description = "店铺等级")
    private String shopLevelId;

    @Schema(description = "店铺层级")
    private Integer storey;

    @Schema(description = "是否充值")
    private Integer charged;

    @Schema(description = "最小提现次数")
    private Integer wlNumMin;

    @Schema(description = "最大提现次数")
    private Integer wlNumMax;

    private List<Long> shopIds;

    /********订单信息*********************/

    /**
     * 订单开始时间
     */
    @Schema(description = "订单开始时间")
    private Long startOrderDate;
    /**
     * 订单结束时间
     */
    @Schema(description = "订单结束时间")
    private Long endOrderDate;

    /**
     * 审核开始时间
     */
    @Schema(description = "审核开始时间")
    private Long startAuditDate;
    /**
     * 审核结束时间
     */
    @Schema(description = "审核结束时间")
    private Long endAuditDate;



    /**
     * 状态 0：待审核，1：审核通过，-1：审核不通过 2：已取消
     */
    @Schema(description = "订单状态")
    private Integer orderStatus;


    /**
     * 支付方式 1：银行卡，2：usdt
     *
     */
    @Schema(description = "支付方式 1：银行卡，2：usdt")
    private String payMethod;


    @Schema(description = "银行卡号/合约地址")
    private String accountNumber;

    private boolean exc;


    public void setUserName(String userName) {
        this.userName = userName;
        listener(userName);
    }

    public void setUserSysType(Integer userSysType) {
        this.userSysType = userSysType;
        listener(userSysType);
    }

    public void setUserDirectPush(String userDirectPush) {
        this.userDirectPush = userDirectPush;
        listener(userDirectPush);
    }

    public void setUser3rdGeneration(String user3rdGeneration) {
        this.user3rdGeneration = user3rdGeneration;
        listener(user3rdGeneration);
    }

    public void setUserUnderUmbrella(String userUnderUmbrella) {
        this.userUnderUmbrella = userUnderUmbrella;
        listener(userUnderUmbrella);
    }

    public void setShopCode(String shopCode) {
        this.shopCode = shopCode;
        listener(shopCode);
    }

    public void setShopStatus(String shopStatus) {
        this.shopStatus = shopStatus;
        listener(shopStatus);
    }

    public void setBalanceStart(BigDecimal balanceStart) {
        this.balanceStart = balanceStart;
        listener(balanceStart);
    }

    public void setBalanceEnd(BigDecimal balanceEnd) {
        this.balanceEnd = balanceEnd;
        listener(balanceEnd);
    }

    public void setShopName(String shopName) {
        this.shopName = shopName;
        listener(shopName);
    }

    public void setShopLevelId(String shopLevelId) {
        this.shopLevelId = shopLevelId;
        listener(shopLevelId);
    }

    public void setStorey(Integer storey) {
        this.storey = storey;
        listener(storey);
    }

    public void setCharged(Integer charged) {
        this.charged = charged;
        listener(charged);
    }

    public void setWlNumMin(Integer wlNumMin) {
        this.wlNumMin = wlNumMin;
        listener(wlNumMin);
    }

    public void setWlNumMax(Integer wlNumMax) {
        this.wlNumMax = wlNumMax;
        listener(wlNumMax);
    }

    public void setShopIds(List<Long> shopIds) {
        this.shopIds = shopIds;
        listener(shopIds);
    }

    public void setStartOrderDate(Long startOrderDate) {
        this.startOrderDate = startOrderDate;
        listener(startOrderDate);
    }

    public void setEndOrderDate(Long endOrderDate) {
        this.endOrderDate = endOrderDate;
        listener(endOrderDate);
    }

    public void setStartAuditDate(Long startAuditDate) {
        this.startAuditDate = startAuditDate;
        listener(startAuditDate);
    }

    public void setEndAuditDate(Long endAuditDate) {
        this.endAuditDate = endAuditDate;
        listener(endAuditDate);
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
        listener(orderStatus);
    }

    public void setPayMethod(String payMethod) {
        this.payMethod = payMethod;
        listener(payMethod);
    }

    public void setAccountNumber(String accountNumber) {
        this.accountNumber = accountNumber;
        listener(accountNumber);
    }

    private void listener(Object o){
        if (o!=null){
            if (StringUtils.isBlank(o.toString())){
                return;
            }
            this.exc=true;
        }
    }

    public LocalDateTime getStartOrderDate() {
        if (startOrderDate==null){
            return null;
        }
        return LocalDateTime.ofInstant(Instant.ofEpochMilli(startOrderDate), ZoneId.systemDefault());
    }

    public LocalDateTime getEndOrderDate() {
        if (endOrderDate==null){
            return null;
        }
        return LocalDateTime.ofInstant(Instant.ofEpochMilli(endOrderDate), ZoneId.systemDefault());
    }

    public LocalDateTime getStartAuditDate() {
        if (startAuditDate==null){
            return null;
        }
        return LocalDateTime.ofInstant(Instant.ofEpochMilli(startAuditDate), ZoneId.systemDefault());
    }

    public LocalDateTime getEndAuditDate() {
        if (endAuditDate==null){
            return null;
        }
        return LocalDateTime.ofInstant(Instant.ofEpochMilli(endAuditDate), ZoneId.systemDefault());
    }
}

